<?php

namespace app\xwam\controller;

/**
 * 地区控制器
 * 
 * @version 1.0 2014-12-8 by sutroon
 */
class AreaController extends AppbaseController {

    /**
     * 获取json数据
     * @version 2014-12-10 by sutroon
     * @example 
     *  省份：?s=Region/json.html
     *  城市：?s=Region/json/province/福建省.html
     *  地区：?s=Region/json/province/福建省/city/厦门市.html
     */
    public function index($province = '', $city = '') {
        $list = $m_area->get_areas($province, $city);
        return json_encode($list);
    }
    public function get_province(){
        $list = \app\xwam\model\AreaModel::getProvinces();
        return json_encode($list);
    }
    public function get_city($pid){
        $list = \app\xwam\model\AreaModel::getCity($pid);
        return json_encode($list);
    }
    public function get_area($pid,$cid){
        $list = \app\xwam\model\AreaModel::getArea($pid,$cid);
        return json_encode($list);        
    }

}
